package com.newviews.tcmip.web.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.newviews.tcmip.common.constant.CommonConsts;
import com.newviews.tcmip.common.model.ResultModel;
import com.newviews.tcmip.pojo.po.EtcmIngrHalfLifePeriodPo;
import com.newviews.tcmip.service.inf.EtcmIngrHalfLifePeriodServiceInf;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 字典-成分半衰期时间 前端控制器
 * </p>
 *
 * @author lxc
 * @since 2024-03-13
 */
@RestController
@RequestMapping("/etcm/ingr/halfLifePeriod")
@Api(tags = "成分半衰期")
public class EtcmIngrHalfLifePeriodController {
    @Autowired
    private EtcmIngrHalfLifePeriodServiceInf etcmIngrHalfLifePeriodService;

    @GetMapping("/list")
    @ApiOperation("获取成分半衰期信息")
    public ResultModel<List<EtcmIngrHalfLifePeriodPo>> getList(@RequestParam String langCode){
        List<EtcmIngrHalfLifePeriodPo> list = etcmIngrHalfLifePeriodService.list(new QueryWrapper<EtcmIngrHalfLifePeriodPo>().eq(EtcmIngrHalfLifePeriodPo.STATUS, CommonConsts.STR_COMMON_YES).eq(EtcmIngrHalfLifePeriodPo.LANGUAGE_CODE, langCode).orderByAsc(EtcmIngrHalfLifePeriodPo.HALF_LIFE_PERIOD_SORT));
        return new ResultModel<List<EtcmIngrHalfLifePeriodPo>>().success(list);
    }
}
